package dao.impl;

import dao.LoginDao;
import pojo.Login;

import java.sql.SQLException;
import java.util.List;

public class LoginDaoImpl extends BaseDao implements LoginDao {
    @Override
    public int saveLogin(Login login) throws SQLException {
        String sql = "insert into login values(?,?,?,?,?,?)";
        return update(sql,login.getCid(),login.isLoginiconpass(),login.isGithubpass(),login.getUsername(),login.getPassword(),login.isPass());
    }

    @Override
    public List<Login> getAllList() throws SQLException {
        String sql = "select * from login";
        return queryForList(Login.class,sql);
    }

    @Override
    public Login getOneLogin(String cid) throws SQLException {
        String sql = "select * from login where cid = ?";
        return queryForOne(Login.class,sql,cid);
    }
}
